\ProvidesPackage{silaboUNSA}

% the following tests if we are running latex or pdflatex
% We can then later use \ifpdf to determine what we are running
%\newif\ifpdf
%\ifx\pdfoutput\undefined
%    \pdffalse
%\else
%    \pdfoutput=1
%    \pdftrue
%\fi


%para texto en UTF
\usepackage{ucs}
\usepackage[utf8x]{inputenc}

%varios
\usepackage{url}
\usepackage[spanish]{babel}
\usepackage{multirow}
\usepackage{multibib}

%margenes
\usepackage[a4paper, margin=1.5cm]{geometry}


% use appropriate package option since some distinguish between 
% tex and tex
%\ifpdf		
%    \usepackage[pdftex]{graphicx}
%	\usepackage[pdftex]{color}
%\else
%    \usepackage{graphicx}
%	\usepackage{color}
%\fi

\usepackage{graphicx}

\newcites{bas}{Básica}
\newcites{com}{Complementaria}

\gdef\@courseCode{}
\gdef\courseCode#1{\gdef\@courseCode{#1}}

\gdef\@course{}
\gdef\course#1{\gdef\@course{#1}}

\gdef\@credits{}
\gdef\credits#1{\gdef\@credits{#1}}

\gdef\@prerequisites{}
\gdef\prerequisites#1{\gdef\@prerequisites{#1}}

\gdef\@year{}
\gdef\year#1{\gdef\@year{#1}}

\gdef\@semester{}
\gdef\semester#1{\gdef\@semester{#1}}

\gdef\@weekTime{}
\gdef\weekTime#1{\gdef\@weekTime{#1}}

\gdef\@T{}
\gdef\T#1{\gdef\@T{#1}}

\gdef\@TP{}
\gdef\TP#1{\gdef\@TP{#1}}

\gdef\@S{0}
\gdef\S#1{\gdef\@S{#1}}

\gdef\@P{}
\gdef\P#1{\gdef\@P{#1}}

\gdef\@mondayRoom{}
\gdef\@monday{}
\gdef\monday#1#2{\gdef\@mondayRoom{#2} \gdef\@monday{#1}}

\gdef\@tuesdayRoom{}
\gdef\@tuesday{}
\gdef\tuesday#1#2{\gdef\@tuesdayRoom{#2} \gdef\@tuesday{#1}}

\gdef\@wednesdayRoom{}
\gdef\@wednesday{}
\gdef\wednesday#1#2{\gdef\@wednesdayRoom{#2} \gdef\@wednesday{#1}}

\gdef\@thursdayRoom{}
\gdef\@thursday{}
\gdef\thursday#1#2{\gdef\@thursdayRoom{#2} \gdef\@thursday{#1}}

\gdef\@fridayRoom{}
\gdef\@friday{}
\gdef\friday#1#2{\gdef\@fridayRoom{#2} \gdef\@friday{#1}}

\gdef\@saturdayRoom{}
\gdef\@saturday{}
\gdef\saturday#1#2{\gdef\@saturdayRoom{#2} \gdef\@saturday{#1}}


\gdef\@teacher{}
\gdef\teacher#1{\gdef\@teacher{#1}}

\gdef\@teacherDegree{Bachiller}
\gdef\teacherDegree#1{\gdef\@teacherDegree{#1}}

\gdef\@profession{Ingeniero de Sistemas}
\gdef\profession#1{\gdef\@profession{#1}}



\def\maketitle{%
    \begin{minipage}{2cm}
     \includegraphics{unsa}
    \end{minipage}
   \hfill 
    \begin{minipage}{16cm}
     \begin{center}
     \begin{large}\textbf{UNIVERSIDAD NACIONAL DE SAN AGUSTÍN DE AREQUIPA}\end{large}\\%
     \vspace{0.3cm}%
     \begin{Large}\textbf{VICE RECTORADO ACADÉMICO}\end{Large}\\%
     \vspace{0.5cm}%
     \begin{LARGE}\textbf{SÍLABO}\end{LARGE}
     \end{center}
    \end{minipage}
    \begin{quote}

    \begin{flushright}
      \begin{tabular}{|r|}
         \hline%
         \begin{large}\textbf{CÓDIGO DEL CURSO: }\@courseCode\end{large}\\%
         \hline%
      \end{tabular}

    \end{flushright}
     
    \end{quote}
    \vspace{0.5cm}
    
}%

\def\makeData{
\begin{tabular*}{0.9\textwidth}{@{\extracolsep{\fill}}|l|l|l|l|l|l|l|l|l|l|l|p{0.5cm}|}
   \hline
   \multicolumn{12}{|l|}{\textbf{FACULTAD: } Ing. de Producción y Servicios}\\
   \hline
   \multicolumn{6}{|l|}{\textbf{DEPARTAMENTO: } Ingeniería de Sistemas e Informática}&
   \multicolumn{6}{l|}{\textbf{ESCUELA: } Ingeniería de Sistemas}\\
   \hline
   \multicolumn{12}{|l|}{\textbf{PROFESOR: } \@teacher}\\
   \multicolumn{5}{|l}{\textbf{TÍTULO: } \@profession}&
   \multicolumn{7}{l|}{\textbf{GRADO ACADÉMICO: } \@teacherDegree}\\
   \hline
   \multicolumn{12}{|l|}{\textbf{ASIGNATURA : }  \@course}\\
   \hline

   \multirow{2}{*}{\textbf{PRE REQUISITO: }\@prerequisites}&
   \multicolumn{4}{c}{\textbf{CRÉDITOS: }}&
   \multicolumn{3}{|l|}{\textbf{Año: }\@year}&
   \multicolumn{4}{l|}{\textbf{HORAS TOTALES:} \@weekTime}\\
   \cline{6-12}
   &\multicolumn{4}{c}{\@credits}&
   \multicolumn{3}{|l|}{\textbf{Semestre: }\@semester}&
   \textbf{T:}\@T & \textbf{TP:}\@TP & \textbf{P:}\@P & \textbf{S:}\@S\\
   \hline
   \multicolumn{1}{|c}{HORARIO}&
   \multicolumn{2}{|c|}{Lunes}&
   \multicolumn{2}{c|}{Martes}&
   \multicolumn{2}{c|}{Miércoles}&
   \multicolumn{2}{c|}{Jueves}&
   \multicolumn{2}{c|}{Viernes}&
   \multicolumn{1}{c|}{Sábado}\\
   \cline{2-12}
   \multicolumn{1}{|c}{Total Semanal}&
   \multicolumn{2}{|c|}{\@monday}&
   \multicolumn{2}{c|}{\@tuesday}&
   \multicolumn{2}{c|}{\@wednesday}&
   \multicolumn{2}{c|}{\@thursday}&
   \multicolumn{2}{c|}{\@friday}&
   \multicolumn{1}{c|}{\@saturday}\\
   \hline
   \multicolumn{1}{|c}{aula}&
   \multicolumn{2}{|c|}{\@mondayRoom}&
   \multicolumn{2}{c|}{\@tuesdayRoom}&
   \multicolumn{2}{c|}{\@wednesdayRoom}&
   \multicolumn{2}{c|}{\@thursdayRoom}&
   \multicolumn{2}{c|}{\@fridayRoom}&
   \multicolumn{1}{c|}{\@saturdayRoom}\\
   \hline
   \end{tabular*}
}%

\renewcommand{\date}[1]{
\vspace{1cm}
 \begin{flushright}
   #1
 \end{flushright}
\vspace{1cm}
\begin{flushright}
   \begin{tabular}{c}
    \hline
    \@teacher
   \end{tabular}
\end{flushright}
}

\newlength{\cw}
\newlength{\lw}
\settowidth{\lw}{|}
%\setlength{\lw}{0.7\doublerulesep}
\setlength{\cw}{\textwidth}
\addtolength{\cw}{-2\tabcolsep}
\addtolength{\cw}{-2\lw}

\newlength{\cwu}
\setlength{\cwu}{\cw}
\addtolength{\cwu}{-3\tabcolsep}
\addtolength{\cwu}{-2\lw}
\addtolength{\cwu}{-.74in}
\newcounter{conti}
\setcounter{conti}{1}

\newenvironment{data}
{
   \section{DATOS GENERALES}
   \begin{quote}
}
{\end{quote}}

\newenvironment{motivation}{
   \section{EXPOSICIÓN DE MOTIVOS}
   \begin{quote}
}{
   \end{quote}
}

\newenvironment{objective}{
   \section{OBJETIVOS}
   \begin{quote}
}{
   \end{quote}
}


\newenvironment{mylist}{
   \begin{list}{$\bullet$}{
      \setlength{\labelwidth}{5pt}%
      \setlength{\leftmargin}{7pt}%
      \setlength{\labelsep}{3pt}}%
}
{
   \end{list}
}


\newcommand{\startObjectives}{\begin{mylist}}
\newcommand{\finishObjectives}{\end{mylist}&}

\newcommand{\startTopics}{\begin{mylist}}
\newcommand{\finishTopics}{\end{mylist}&}

\newcommand{\hours}[1]{#1 &}
\newcommand{\dates}[1]{#1 &}
\newcommand{\porcent}[1]{#1}

\newcommand{\unit}[6]{

   \hspace{0.5cm}
   
   \begin{tabular*}{0.915\textwidth}{|p{0.4\cwu}|p{0.4\cwu}|l|p{0.1\cwu}|p{0.092\cwu}|}
      \multicolumn{5}{l}{\textbf{Capítulo \arabic{conti}: }\large{#1}}\\
      \hline
      \textbf{Objestivos Específicos} & 
      \textbf{Contenidos} & 
      \textbf{Hrs.}&
      \textbf{Fecha}&
      \textbf{Avance}\\
      \hline
   \startObjectives%
      #2
   \finishObjectives%
   \startTopics
      #3
   \finishTopics
   \hours{#4}
   \dates{#5}
   \porcent{#6}
 \%\\%
 \hline%
\end{tabular*}
   \addtocounter{conti}{1}
   \vspace{0.5cm}
}

\newcommand{\obj}{\item}
\newcommand{\tema}{\item}
\newcommand{\hrs}{}
\newcommand{\fecha}{}
\newcommand{\porc}{}

\newenvironment{lecturas}
{
        \begin{description}
}
{
        \end{description}
}
\newcommand{\obligatoria}[1]{\item[Lectura Obligatoria] \citebas{#1}}
\newcommand{\sugerida}[1]{\item[Lectura Sugerida] \citecom{#1}}

\newenvironment{temas}{\section{CONTENIDO TEMÁTICO}}{}

\newenvironment{actividades}{
\section{ACTIVIDADES}
   \begin{quote}
   \begin{itemize}
}{
   \end{itemize}
   \end{quote}
}

\newenvironment{recursos}{
\section{RECURSOS MATERIALES}
   \begin{quote}
   Los recursos materiales son:
   
   \begin{itemize}
}{
   \end{itemize}
   \end{quote}
}

\newenvironment{bibliografia}{
\section{RECURSOS BIBLIOGRÁFICOS}
\begin{quote}
   \renewcommand{\refnamebas}{}
   \renewcommand{\refnamecom}{}
   \bibliographystylebas{alpha}

   \textbf{Obligatoria}
   \vspace{-1.5cm}
   \bibliographybas{silabo}
   
   \bibliographystylecom{alpha}
   \textbf{Sugerida}
   \vspace{-1.5cm}
   \bibliographycom{silabo}
}{
\end{quote}
}

\newenvironment{metodologia}{
\section{METODOLOGÍA}
\begin{quote}
}{
\end{quote}
}

\newenvironment{evaluacion}{
\section{EVALUACION}
\begin{quote}
}{
\end{quote}
}

\newcommand{\act}{\item}
\newcommand{\rec}{\item}

